package com.ljph.jfinal.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by yuzhou on 16/8/11.
 */
public class LogInterceptor implements Interceptor {

    @Override
    public void intercept(Invocation inv) {
        Logger _log = LoggerFactory.getLogger(inv.getTarget().getClass());

        _log.info("Before method {} is called", inv.getMethodName());
        inv.invoke();
        _log.info("After method {} is called", inv.getMethodName());
    }
}
